﻿using ConfExpert.Forms.Base;
using DevTeam;
using System;
using System.Windows.Forms;

namespace ConfExpert.Planlama
{
    public partial class YeniSiparis : XForm
    {
        public YeniSiparis()
        {
            InitializeComponent();
        }

        private void YeniSiparis_Load(object sender, EventArgs e)
        {
            deSipTarihi.EditValue = DateTime.Today;
            gleUserId.Properties.Assign(RI(Rp.V_User));
            //gleUserId.EditValue = WhoAmI;
            gleBrandId.Properties.Assign(RI(Rp.Brand));
            cmbTip.Text = "Üretim";

            this.Shown += new EventHandler(YeniSiparis_Shown);
        }

        void YeniSiparis_Shown(object sender, EventArgs e)
        {
            gleBrandId.Focus();
        }

        public string SipNo = string.Empty;
        private void btnKaydet_Click(object sender, EventArgs e)
        {
            try
            {
                SipNo = ExecuteScalar("GetSipNo", teSipNo.Text, cmbTip.Text, deSipTarihi.EditValue, gleUserId.EditValue, gleBrandId.EditValue, meNotlar.Text).ToString();
            }
            catch (Exception Ex)
            {
                throw (Ex);
            }
            finally
            {
                this.DialogResult = DialogResult.OK;
            }
        }

        private void btnIptal_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
        }
    }
}